package com.sharding.demo.controller;

import com.sharding.demo.service.OrdersService;
import com.sharding.demo.vo.OffocialDemoVo;
import com.sharding.demo.vo.OrdersVo;
import com.sharding.demo.vo.UserStaticsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController()
@RequestMapping("/common")
public class CommonController {
 
    @Autowired
    private OrdersService ordersService;


    /**
     * 1. 统计销量前10的商品，商品名称、总金额、商品信息，订单总数
     * 2. 统计购买数量前10的用户，用户名称、总金额、订单总数
     * 3. 找到某个用户的订单列表，关联商品信息
     * @return
     */

    @GetMapping("/1")
    public List<UserStaticsVo> select() {
        return ordersService.staticsUser();
    }

    @GetMapping("/2")
    public List<UserStaticsVo> select2() {
        return ordersService.staticsUserSingle();
    }
    @GetMapping("/3")
    public List<OffocialDemoVo> select3(OrdersVo state) {
        return ordersService.officialDemo(state);
    }


}